package com.shop.resource.controller;

import com.shop.resource.api.IFileApi;
import com.shop.resource.service.IFileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import java.util.Map;

/**
 * @Description:
 *
 * @author zhoulk
 * @date: 2019年05月08日  17:32
 */
@RestController
@CrossOrigin
public class FileController implements IFileApi {

    private static final Logger logger = LoggerFactory.getLogger(FileController.class);

    @Autowired
    IFileService fileService;

    @Override
    public Map<String, Object> uploadImgToQi(MultipartHttpServletRequest request) {
        MultipartFile img= request.getFile("imgFile");
        logger.info("上传图片");
        return fileService.uploadImgToQi(img);
    }
}
